<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

</head>

<body>
    <button id="b">11</button>

    <script>
        function debounce() {
            let timer;

            function end() {
                console.log(1);
            }

            return function () {
                clearTimeout(timer);
                timer = setTimeout(end, 1000);
            }
        }

        let a;
        a = document.querySelector('#b');
        a.addEventListener('click', debounce());
    </script>
</body>

</html>
